//需要填充 
let reqid = 0;
export let getOrder = ({
	instid,
	dc,
	kp,
	price,
	vol
}) => {
	function pad(num, n) {
		return Array(n > num ? (n - ('' + num).length + 1) : 0).join(0) + num;
	}
	var dt = new Date();
	var h = dt.getHours(),
		m = dt.getMinutes(),
		s = dt.getSeconds();

	if (dt.getHours() <= 3) {
		h = h + 24;
	}
	let localid = pad(h, 2) + pad(m, 2) + pad(s, 2) + pad(reqid, 3);
	reqid++;
	if (reqid > 999) {
		reqid = 1;
	}

	let Td = uni.getStorageSync('td') && JSON.parse(uni.getStorageSync('td'));
	var order = {
		account_id: Td.account_id,
		account_no: Td.account_no,
		inst_id: instid,
		"dc": dc,
		"kp": kp,
		"price": price,
		"vol": vol,
		status: "submit",
		local_id: localid
	};
	order.insert_time = dt;
	order.update_time = dt;
	return order;
}


export let utoolTime = (val) => {
	let date = new Date(val);
	console.log(date,'==========》333')
	let year = date.getFullYear();
	let month = date.getMonth() + 1;
	let day = date.getDate();

	let h = date.getHours();
	let m = date.getMinutes();
	let s = date.getSeconds();

	let fn = (val) => {
		val = val.toString();
		return val[1] ? val : '0' + val
	}

	return  [h, m, s].map(fn).join(':')
}